home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / ServerModels / Jsp / dwscriptsServerImpl.js < prev   
Encoding:
JavaScript  |  2003-09-05  |  20.0 KB  |  893 lines

  1. // Copyright 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. // *************** GLOBALS VARS *****************
  4.  
  5. // ***************** LOCAL FUNCTIONS  ******************
  6.  
  7. //--------------------------------------------------------------------
  8. // FUNCTION:
  9. //   queueDefaultDocEdits
  10. //
  11. // DESCRIPTION:
  12. //   This function is called before the docEdits are applied to the
  13. //   page to allow any default doc edits to be added.  We will add
  14. //   the VBSCRIPT language tag.
  15. //
  16. // ARGUMENTS:
  17. //   none
  18. //
  19. // RETURNS:
  20. //   nothing
  21. //--------------------------------------------------------------------
  22.  
  23. function queueDefaultDocEdits()
  24. {
  25.   var partList = dw.getParticipants("PageDirective_main");
  26.   if (!partList || partList.length == 0)  // does not currently exist
  27.   {
  28.     var encoding = dw.getDocumentDOM().getCharSet();
  29.     if (encoding != "")
  30.     {
  31.        encoding = "text/html; charset=" + encoding;
  32.     }
  33.  
  34.     var paramObj = new Object();
  35.     paramObj.ContentType = encoding;
  36.     paramObj.Language = "java";
  37.     paramObj.Imports = "java.sql.*";
  38.     paramObj.ErrorPage = "";
  39.     dwscripts.queueDocEditsForParticipant("PageDirective_main",paramObj);
  40.   }
  41.   else
  42.   {
  43.     dwscripts.queueParticipantInfo("PageDirective_main", partList[0].participantNode);
  44.   }
  45.  
  46.   partList = dw.getParticipants("SetEncoding_language");
  47.     
  48.   if (partList && partList.length)
  49.   {
  50.     dwscripts.queueParticipantInfo("SetEncoding_language", partList[0].participantNode);
  51.   }    
  52. }
  53.  
  54.  
  55. //--------------------------------------------------------------------
  56. // FUNCTION:
  57. //   encodeDynamicExpression
  58. //
  59. // DESCRIPTION:
  60. //   This function prepares a dynamic expression for insertion onto
  61. //   the page.  It is assumed that this expression will be used
  62. //   within a larger dynamic statement, therefore all server markup
  63. //   is stripped.
  64. //
  65. // ARGUMENTS:
  66. //   expression - string - the dyanmic expression to encode
  67. //
  68. // RETURNS:
  69. //   string
  70. //--------------------------------------------------------------------
  71.  
  72. function encodeDynamicExpression(expression)
  73. {
  74.   var retVal = "";
  75.   expression = expression.toString();
  76.  
  77.   if (hasServerMarkup(expression))
  78.   {
  79.     retVal = trimServerMarkup(expression);
  80.   }
  81.   else
  82.   {
  83.     // quote all values for JSP
  84.     if (!dwscripts.isQuoted(expression))
  85.     {
  86.       retVal = "\"" + dwscripts.escQuotes(expression) + "\"";
  87.     }
  88.     else
  89.     {
  90.       retVal = expression;
  91.     }
  92.   }
  93.  
  94.   return retVal;
  95. }
  96.  
  97.  
  98. //--------------------------------------------------------------------
  99. // FUNCTION:
  100. //   decodeDynamicExpression
  101. //
  102. // DESCRIPTION:
  103. //   This function prepares a dynamic expression for display within
  104. //   a dialog box.  Quotes are removed,a nd server markup is re-added.
  105. //
  106. // ARGUMENTS:
  107. //   expression - string - the dynamic expression to prepare for display
  108. //
  109. // RETURNS:
  110. //   string
  111. //--------------------------------------------------------------------
  112.  
  113. function decodeDynamicExpression(expression)
  114. {
  115.   var retVal = "";
  116.  
  117.   expression = dwscripts.trim(expression.toString());
  118.   var unquoted = dwscripts.trimQuotes(expression);
  119.  
  120.   if (dwscripts.isQuoted(expression))
  121.   {
  122.     retVal = dwscripts.unescQuotes(unquoted);
  123.   }
  124.   else
  125.   {
  126.     retVal = "<%= " + expression + " %>";
  127.   }
  128.  
  129.   return retVal;
  130. }
  131.  
  132.  
  133. //--------------------------------------------------------------------
  134. // FUNCTION:
  135. //   hasServerMarkup
  136. //
  137. // DESCRIPTION:
  138. //   This function returns true if the given expression contains
  139. //   server markup.
  140. //
  141. // ARGUMENTS:
  142. //   expression - string - the expression to test for server markup
  143. //
  144. // RETURNS:
  145. //   boolean
  146. //--------------------------------------------------------------------
  147.  
  148. function hasServerMarkup(expression)
  149. {
  150.   expression = expression.toString();
  151.   return (expression.indexOf("<%") != -1 && expression.indexOf("%>") != -1);
  152. }
  153.  
  154.  
  155. //--------------------------------------------------------------------
  156. // FUNCTION:
  157. //   trimServerMarkup
  158. //
  159. // DESCRIPTION:
  160. //   This function returns the given expression with any server markup
  161. //   removed.
  162. //
  163. // ARGUMENTS:
  164. //   expression - string - the expression to remove server markup from
  165. //
  166. // RETURNS:
  167. //   string
  168. //--------------------------------------------------------------------
  169.  
  170. function trimServerMarkup(expression)
  171. {
  172.   var retVal = expression.toString();
  173.  
  174.   if (retVal.length)
  175.   {
  176.     var begininlineindex = retVal.indexOf("<%=");
  177.     var endinlineindex  =  retVal.indexOf("%>");
  178.     if ((begininlineindex != -1) && (endinlineindex!=-1))
  179.     {
  180.       retVal = retVal.substring(begininlineindex+3, endinlineindex);
  181.     }
  182.     else
  183.     {
  184.       var begininlineindex = retVal.indexOf("<%");
  185.       var endinlineindex  =  retVal.indexOf("%>");
  186.       if ((begininlineindex != -1) && (endinlineindex!=-1))
  187.       {
  188.         retVal = retVal.substring(begininlineindex+3, endinlineindex);
  189.       }
  190.     }
  191.  
  192.     retVal = dwscripts.trim(retVal);
  193.   }
  194.  
  195.   return retVal;
  196. }
  197.  
  198.  
  199. //--------------------------------------------------------------------
  200. // FUNCTION:
  201. //   getDBColumnTypeEnum
  202. //
  203. // DESCRIPTION:
  204. //   This function returns the enumerated value corresponding to the
  205. //   given column type.  The enumeration numbers should match those
  206. //   used by the databases themselves.
  207. //
  208. // ARGUMENTS:
  209. //   columnType - string - a column type as returned by the MMDB functions
  210. //
  211. // RETURNS:
  212. //   enumeration number
  213. //--------------------------------------------------------------------
  214.  
  215. var DB_COLUMN_ENUM_MAP = null;
  216.  
  217. function getDBColumnTypeEnum(columnType)
  218. {
  219.   var retVal = 0;
  220.  
  221.   columnType = String(columnType);
  222.  
  223.   if (dwscripts.isNumber(columnType))
  224.   {
  225.     retVal = dwscripts.getNumber(columnType);
  226.   }
  227.   else
  228.   {
  229.     if (DB_COLUMN_ENUM_MAP == null)
  230.     {
  231.       var a = new Array();
  232.  
  233.       a["null"] = 0;
  234.       a["char"] = 1;
  235.       a["numeric"] = 2;
  236.       a["int identity"]=2; //as varchar
  237.       a["counter"]=2;
  238.       a["varnumeric"] = 2;
  239.       a["number"] = 2;
  240.       a["money"]=2;
  241.       a["smallmoney"]=2;
  242.       a["currency"]=2;
  243.       a["uniqueidentifier"]=2;
  244.       a["rowid"]=2;
  245.       a["mediumint"]=2;
  246.       a["decimal"] = 3;
  247.       a["integer"] = 4;
  248.       a["long"] = 4;
  249.       a["int"] = 4;
  250.       a["mediumint"] = 4; //integer
  251.       a["smallint"] = 5;
  252.       a["smallint identity"] = 5;
  253.       a["float"] = 6;
  254.       a["float unsigned zerofill"] = 6; //double
  255.  
  256.       a["real"] = 7;
  257.       a["double"] = 8;
  258.       a["double unsigned zerofill"] = 8;
  259.  
  260.       a["longchar"] = 12; 
  261.       a["varchar"] = 12;
  262.  
  263.       a["date"] = 91;
  264.       a["time"] = 92;
  265.       a["timestamp"] = 93;
  266.       a["datetime"] = 93;
  267.       a["smalldatetime"]=93;
  268.       a["year"] = 93; //dbdate
  269.  
  270.       a["varchar2"] = 1111;
  271.  
  272.       a["distinct"] = 2001;
  273.       a["struct"] = 2002;
  274.       a["enum"] = 2002; //var char
  275.       a["set"] = 2002; //userdefined
  276.       a["array"] = 2003;
  277.       a["blob"] = 2004;
  278.       a["image"]=2004;
  279.       a["clob"] = 2005;
  280.       a["ref"] = 2006;
  281.       a["ref cursor"] = 2006;
  282.  
  283.       a["longvarchar"] = -1;
  284.       a["binary"] = -2;
  285.       a["raw"] = -2;
  286.       a["varbinary"] = -3;
  287.       a["longvarbinary"] = -4;
  288.       a["bigint"] = -5;
  289.       a["tinyint"] = -6;
  290.       a["bit"] = -7;
  291.       a["nchar"] = -8;
  292.       a["nvarchar"] = -9;
  293.       a["nvarchar2"] = -9;
  294.       a["text"] = -10;
  295.       a["ntext"] = -10;
  296.       a["tinytext"] = -10; //varchar
  297.       a["mediumtext"] = -10; //varchar
  298.       a["longtext"] = -10; //longvarchar
  299.       a["pl/sql"]=2006; //oracle specific pl/sql
  300.       a["object"]=2006; //oracle specific object
  301.       a["id"]=12; //as varchar
  302.  
  303.  
  304.       DB_COLUMN_ENUM_MAP = a;
  305.     }
  306.  
  307.     if (DB_COLUMN_ENUM_MAP != null)
  308.     {
  309.       if (columnType.indexOf("pl/sql")!=-1)
  310.       {
  311.         columnType = "pl/sql";
  312.       }
  313.  
  314.       retVal = DB_COLUMN_ENUM_MAP[columnType.toLowerCase()];
  315.  
  316.       if (retVal == null)
  317.       {
  318.         alert(dwscripts.sprintf(MM.MSG_SQLTypeAsNumNotInMap,columnType));
  319.         retVal = 0;
  320.       }
  321.     }
  322.   }
  323.  
  324.   return retVal;
  325. }
  326.  
  327.  
  328. //--------------------------------------------------------------------
  329. // FUNCTION:
  330. //   getDBColumnTypeAsString
  331. //
  332. // DESCRIPTION:
  333. //   This function returns a string representation of the given
  334. //   column type.
  335. //
  336. // ARGUMENTS:
  337. //   columnType - string - a column type string returned from MMDB
  338. //
  339. // RETURNS:
  340. //   string
  341. //--------------------------------------------------------------------
  342.  
  343. var DB_COLUMN_STRING_MAP = null;
  344.  
  345. function getDBColumnTypeAsString(columnType)
  346. {
  347.   var retVal = "Empty";
  348.  
  349.   var typeNum = getDBColumnTypeEnum(columnType);
  350.  
  351.   if (DB_COLUMN_STRING_MAP == null)
  352.   {
  353.     var a = new Array();
  354.  
  355.     a['0'] = "Null";
  356.     a['1'] = "Char";
  357.     a['2'] = "Numeric";
  358.     a['3'] = "Decimal";
  359.     a['4'] = "Integer";
  360.     a['5'] = "SmallInt";
  361.     a['6'] = "Float";
  362.     a['7'] = "Real";
  363.     a['8'] = "Double";
  364.     a['12'] = "VarChar";
  365.  
  366.     a['91'] = "Date";
  367.     a['92'] = "Time";
  368.     a['93'] = "Timestamp";
  369.  
  370.     a['1111'] = "VarChar2";
  371.  
  372.     a['2001'] = "Distinct";
  373.     a['2002'] = "Struct";
  374.     a['2003'] = "Array";
  375.     a['2004'] = "Blob";
  376.     a['2005'] = "Clob";
  377.     a['2006'] = "Ref";
  378.  
  379.     a['-1'] = "LongVarChar";
  380.     a['-2'] = "Binary";
  381.     a['-3'] = "VarBinary";
  382.     a['-4'] = "LongVarBinary";
  383.     a['-5'] = "BigInt";
  384.     a['-6'] = "TinyInt";
  385.     a['-7'] = "Bit";
  386.     a['-8'] = "NChar";
  387.     a['-9'] = "NVarChar";
  388.     a['-10'] = "Text";
  389.  
  390.     DB_COLUMN_STRING_MAP = a;
  391.   }
  392.  
  393.   if (DB_COLUMN_STRING_MAP != null)
  394.   {
  395.     retVal = DB_COLUMN_STRING_MAP[String(typeNum)];
  396.   }
  397.  
  398.   if (retVal == null)
  399.   {
  400.     alert(dwscripts.sprintf(MM.MSG_SQLTypeNotInMap, columnType));
  401.     retVal = "";
  402.   }
  403.  
  404.   return retVal;
  405. }
  406.  
  407.  
  408. //--------------------------------------------------------------------
  409. // FUNCTION:
  410. //   isNumericDBColumnType
  411. //
  412. // DESCRIPTION:
  413. //   Returns true if the given column type is numeric.
  414. //
  415. //   If we do not recognize the type of a column as any of the
  416. //   other categories, we default to numeric.
  417. //
  418. // ARGUMENTS:
  419. //   columnType - string - a column type string returned from MMDB
  420. //
  421. // RETURNS:
  422. //   boolean
  423. //--------------------------------------------------------------------
  424.  
  425. function isNumericDBColumnType(columnType)
  426. {
  427.   var retVal = true;
  428.  
  429.   var typeNum = getDBColumnTypeEnum(columnType);
  430.  
  431.   // assume the numeric type, unless it is called out in one
  432.   //  of the other functions below.
  433.  
  434.   switch (typeNum)
  435.   {
  436.     case 1:
  437.     case 12:
  438.     case 91:
  439.     case 92:
  440.     case 93:
  441.     case -1:
  442.     case -8:
  443.     case -9:
  444.     case -10:
  445.     case 1111:
  446.       retVal = false;
  447.   }
  448.  
  449.   return retVal;
  450. }
  451.  
  452.  
  453. //--------------------------------------------------------------------
  454. // FUNCTION:
  455. //   isIntegerDBColumnType
  456. //
  457. // DESCRIPTION:
  458. //   Returns true if the given column type is integer.
  459. //
  460. // ARGUMENTS:
  461. //   columnType - string - a column type string returned from MMDB
  462. //
  463. // RETURNS:
  464. //   boolean
  465. //--------------------------------------------------------------------
  466.  
  467. function isIntegerDBColumnType(columnType)
  468. {
  469.   var retVal  = false;
  470.  
  471.   var typeNum = getDBColumnTypeEnum(columnType);
  472.  
  473.   switch (typeNum)
  474.   {
  475.     case 4:
  476.     case 5:
  477.     case -5:
  478.     case -6:
  479.       retVal = true;
  480.   }
  481.  
  482.   return retVal;
  483. }
  484.  
  485.  
  486. //--------------------------------------------------------------------
  487. // FUNCTION:
  488. //   isDoubleDBColumnType
  489. //
  490. // DESCRIPTION:
  491. //   Returns true if the given column type is double.
  492. //
  493. // ARGUMENTS:
  494. //   columnType - string - a column type string returned from MMDB
  495. //
  496. // RETURNS:
  497. //   boolean
  498. //--------------------------------------------------------------------
  499.  
  500. function isDoubleDBColumnType(columnType)
  501. {
  502.   var retVal  = false;
  503.  
  504.   var typeNum = getDBColumnTypeEnum(columnType);
  505.  
  506.   switch (typeNum)
  507.   {
  508.     case 8:
  509.       retVal = true;
  510.   }
  511.  
  512.   return retVal;
  513. }
  514.  
  515.  
  516. //--------------------------------------------------------------------
  517. // FUNCTION:
  518. //   isStringDBColumnType
  519. //
  520. // DESCRIPTION:
  521. //   This function returns true if the given column type represents
  522. //   a string value
  523. //
  524. // ARGUMENTS:
  525. //   columnType - string - a column type string returned from MMDB
  526. //
  527. // RETURNS:
  528. //   boolean
  529. //--------------------------------------------------------------------
  530.  
  531. function isStringDBColumnType(columnType)
  532. {
  533.   var retVal = false;
  534.  
  535.   var typeNum = getDBColumnTypeEnum(columnType);
  536.  
  537.   switch (typeNum)
  538.   {
  539.     case 1:
  540.     case 12:
  541.     case -1:
  542.     case -8:
  543.     case -9:
  544.     case -10:
  545.     case 1111:
  546.       retVal = true;
  547.   }
  548.  
  549.   return retVal;
  550. }
  551.  
  552.  
  553. //--------------------------------------------------------------------
  554. // FUNCTION:
  555. //   isBinaryDBColumnType
  556. //
  557. // DESCRIPTION:
  558. //   This function returns true if the given column type represents
  559. //   binary data
  560. //
  561. // ARGUMENTS:
  562. //   columnType - string - a column type string returned from MMDB
  563. //
  564. // RETURNS:
  565. //   boolean
  566. //--------------------------------------------------------------------
  567.  
  568. function isBinaryDBColumnType(columnType)
  569. {
  570.   var retVal = false;
  571.  
  572.   var typeNum = getDBColumnTypeEnum(columnType);
  573.  
  574.   switch (typeNum)
  575.   {
  576.     case -2:
  577.     case -3:
  578.     case -4:
  579.     case -7:
  580.       retVal = true;
  581.   }
  582.  
  583.   if (!retVal)
  584.   {
  585.       switch (columnType)
  586.       {
  587.         case "image":
  588.             retVal = true;
  589.       }
  590.   }
  591.  
  592.   return retVal;
  593. }
  594.  
  595.  
  596. //--------------------------------------------------------------------
  597. // FUNCTION:
  598. //   isDateDBColumnType
  599. //
  600. // DESCRIPTION:
  601. //   This function returns true if the given column type represents
  602. //   a date or time value
  603. //
  604. // ARGUMENTS:
  605. //   columnType - string - a column type string returned from MMDB
  606. //
  607. // RETURNS:
  608. //   boolean
  609. //--------------------------------------------------------------------
  610.  
  611. function isDateDBColumnType(columnType)
  612. {
  613.   var retVal = false;
  614.  
  615.   var typeNum = dwscripts.getDBColumnTypeEnum(columnType);
  616.  
  617.   switch (typeNum)
  618.   {
  619.     case 91:
  620.     case 92:
  621.     case 93:
  622.       retVal = true;
  623.   }
  624.  
  625.   return retVal;
  626. }
  627.  
  628.  
  629. //--------------------------------------------------------------------
  630. // FUNCTION:
  631. //   isBooleanDBColumnType
  632. //
  633. // DESCRIPTION:
  634. //   This function returns true if the given column type represents
  635. //   binary data
  636. //
  637. // ARGUMENTS:
  638. //   columnType - string - a column type string returned from MMDB
  639. //
  640. // RETURNS:
  641. //   boolean
  642. //--------------------------------------------------------------------
  643.  
  644. function isBooleanDBColumnType(columnType)
  645. {
  646.   var retVal = false;
  647.  
  648.   var typeNum = getDBColumnTypeEnum(columnType);
  649.  
  650.   switch (typeNum)
  651.   {
  652.     case -7:
  653.       retVal = true;
  654.   }
  655.  
  656.   return retVal;
  657. }
  658.  
  659.  
  660. //--------------------------------------------------------------------
  661. // FUNCTION:
  662. //   isCurrencyDBColumnType
  663. //
  664. // DESCRIPTION:
  665. //   This function returns true if the given column type represents
  666. //   a monetary value
  667. //
  668. // ARGUMENTS:
  669. //   columnType - string - a column type string returned from MMDB
  670. //
  671. // RETURNS:
  672. //   boolean
  673. //--------------------------------------------------------------------
  674.  
  675. function isCurrencyDBColumnType(columnType)
  676. {
  677.   var retVal = false;
  678.   switch (columnType)
  679.   {
  680.     case "money":
  681.     case "smallmoney":
  682.     case "currency":
  683.       retVal = true;
  684.   }
  685.  
  686.   return retVal;
  687. }
  688.  
  689.  
  690. ////////////////////////////////////////////////////////////////////////////////
  691. //These are some helper functions used by SSI infrastructure and not
  692. //part of the Server API.
  693. ////////////////////////////////////////////////////////////////////////////////
  694.  
  695.  
  696. //--------------------------------------------------------------------
  697. // FUNCTION:
  698. //   getRecordsetNames
  699. //
  700. // DESCRIPTION:
  701. //   Returns a list of all recordset names on the page.
  702. //
  703. // ARGUMENTS:
  704. //   dontIncludeStoredProcRS - boolean (optional). 'true' if should not
  705. //     include recordsets returned from stored procedures. defaults to
  706. //     'false'.
  707. //
  708. // RETURNS:
  709. //   array of strings
  710. //--------------------------------------------------------------------
  711.  
  712. function getRecordsetNames(dontIncludeStoredProcRS)
  713. {
  714.   if (!dontIncludeStoredProcRS) dontIncludeStoredProcRS = false;
  715.  
  716.   var nameList = new Array();
  717.   var currentdom = dreamweaver.getDocumentDOM();
  718.  
  719.   if (currentdom) {
  720.     var nodes = currentdom.getElementsByTagName("MM_RECORDSET");
  721.     for (var index =0 ; index < nodes.length ; index++)
  722.     {
  723.       var node = nodes.item(index);
  724.       if (node)
  725.       {
  726.         nameList.push(node.getAttribute("NAME"));
  727.       }
  728.     }
  729.  
  730.     if (!dontIncludeStoredProcRS)
  731.     {
  732.       var nodes = currentdom.getElementsByTagName("MM_CALLRESSET");
  733.       for (var index =0 ; index < nodes.length ; index++)
  734.       {
  735.         var node = nodes.item(index);
  736.         if (node)
  737.         {
  738.           nameList.push(node.getAttribute("NAME"));
  739.         }
  740.       }
  741.     }
  742.   }
  743.  
  744.   return nameList;
  745. }
  746.  
  747.  
  748. //--------------------------------------------------------------------
  749. // FUNCTION:
  750. //   getRepeatedRegionNames
  751. //
  752. // DESCRIPTION:
  753. //   Returns a list of all repeated region names on the page.
  754. //
  755. // ARGUMENTS:
  756. //   None
  757. //
  758. // RETURNS:
  759. //   array of strings
  760. //--------------------------------------------------------------------
  761.  
  762. function getRepeatedRegionNames()
  763. {
  764.   var nameList = new Array();
  765.   var currentdom = dreamweaver.getDocumentDOM();
  766.  
  767.   if (currentdom)
  768.   {
  769.     var nodes = currentdom.getElementsByTagName("MM_REPEATEDREGION");
  770.     for (var index =0 ; index < nodes.length ; index++)
  771.     {
  772.       var node = nodes.item(index);
  773.       if (node)
  774.       {
  775.         nameList.push(node.getAttribute("NAME"));
  776.       }
  777.     }
  778.   }
  779.  
  780.   return nameList;
  781. }
  782.  
  783.  
  784. //--------------------------------------------------------------------
  785. // FUNCTION:
  786. //   findSourceNode
  787. //
  788. // DESCRIPTION:
  789. //   Returns a data source name by name.
  790. //
  791. // ARGUMENTS:
  792. //   elementName - string - the name of the data source
  793. //
  794. // RETURNS:
  795. //   DOM node pointer
  796. //--------------------------------------------------------------------
  797.  
  798. function findSourceNode(elementName)
  799. {
  800.   var foundnode = null;
  801.   var currentdom = dreamweaver.getDocumentDOM();
  802.  
  803.   if (currentdom)
  804.   {
  805.     var nodes = currentdom.getElementsByTagName("MM_RECORDSET");
  806.     for (var index =0 ; index < nodes.length ; index++)
  807.     {
  808.       var node = nodes.item(index);
  809.       if (node)
  810.       {
  811.         if(node.getAttribute("NAME") == elementName)
  812.         {
  813.           foundnode = node;
  814.         }
  815.       }
  816.     }
  817.  
  818.     if (!foundnode)
  819.     {
  820.       var nodes = currentdom.getElementsByTagName("MM_CALLABLE");
  821.       for (var index =0 ; index < nodes.length ; index++)
  822.       {
  823.         var node = nodes.item(index);
  824.         if (node)
  825.         {
  826.           if(node.getAttribute("NAME") == elementName)
  827.           {
  828.             foundnode = node;
  829.           }
  830.         }
  831.       }
  832.     }
  833.  
  834.     if (!foundnode)
  835.     {
  836.       var nodes = currentdom.getElementsByTagName("MM_CALLRESSET");
  837.       for (var index =0 ; index < nodes.length ; index++)
  838.       {
  839.         var node = nodes.item(index);
  840.         if (node)
  841.         {
  842.           if(node.getAttribute("NAME") == elementName)
  843.           {
  844.             foundnode = node;
  845.           }
  846.         }
  847.       }
  848.     }
  849.   }
  850.  
  851.   return foundnode;
  852. }
  853.  
  854.  
  855. //--------------------------------------------------------------------
  856. // FUNCTION:
  857. //   getColumnNames
  858. //
  859. // DESCRIPTION:
  860. //   Returns the column names for the given recordset.
  861. //   If rs is not specified the column names for the first recordset
  862. //   are returned.
  863. //
  864. // ARGUMENTS:
  865. //   rs - string - optional - the name of a data source
  866. //
  867. // RETURNS:
  868. //   array of strings
  869. //--------------------------------------------------------------------
  870.  
  871. function getColumnNames(rs)
  872. {
  873.   var rsDOM, nameList = new Array();
  874.  
  875.   dataSourceNode = findSourceNode(rs);
  876.  
  877.   if (dataSourceNode && dataSourceNode.tagName == "MM_RECORDSET")
  878.   {
  879.     rsDOM = dreamweaver.getDocumentDOM(dreamweaver.getConfigurationPath() + "/DataSources/Jsp/Recordset.htm");
  880.   }
  881.   else if (dataSourceNode && dataSourceNode.tagName == "MM_CALLRESSET")
  882.   {
  883.     var rsDOM = dreamweaver.getDocumentDOM(dreamweaver.getConfigurationPath() + "/DataSources/Jsp/Callable.htm");
  884.   }
  885.  
  886.   if (rsDOM)
  887.   {
  888.     nameList = rsDOM.parentWindow.generateDynamicSourceBindings(rs);
  889.   }
  890.  
  891.   return nameList;
  892. }
  893.